<?php 
session_start();
include_once("db_connect.php");
include("class/objName.php");
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Station Shop Theme - Contact Page</title>
<meta name="keywords" content="station shop, contact page, maps, free templates, website templates, CSS, HTML" />
<meta name="description" content="Station Shop, Contact Page, free CSS template provided by templatemo.com" />

<?php include("include/jquery.php");?>
<style>
    tr { 
        display: table;            /* this makes borders/margins work */
        border: 1px solid black;
       	width:100%;
		margin: 2px 0px 0px 0px;
	}
</style>
</head>
<body>

<div id="templatemo_wrapper">
	<!--header-->
		<?php include("include/header.php");?>
	<!--header-->
    
    <div id="templatemo_main"  style="background-color:black; overflow:auto;" >
   		
		<?php
		if(isset($_REQUEST['value'])){
			$value = mysql_real_escape_string(htmlentities(trim($_GET['value'])));
			$sql = "SELECT * FROM tblswaping where addoff != 'outsider' AND name like'%".$value."%' ";
			$result = mysql_query($sql)or die(mysql_error);
			$brand_data = "";
			if(mysql_num_rows($result)<1 ){
				echo '<div style="padding:10px;"><h3 style="color:white;" >No Item Found</h3></div>';
				die();
			}
			
			
			$obj = new objName();
			
			echo '<div style="padding:10px;"><font style="color:white; font-size:20px">'.mysql_num_rows($result).' result for '.$value.'</font></div>';
			echo "<table border='0' width='100%'>";
			echo "<tr style='background-color:gray; color:white;' > <td width='270px'>Title</td> <td >Description</td> <td>Content</td> </tr>";		
			while($row = mysql_fetch_array($result)){
					$img = $obj->displayimg($row['filename'],true);
					echo "	<tr style=' border: 1px solid white;'>";
					echo "<td valign='top' width='100px'>
						<img id='' style='width:270px; height:180px;' src='images/vehicles/$img'>
						<div>Posted by:<a href='#' style='color:red;' > ".$row['fname'] ." ".$row['lname'] . "</a>";                                            
					echo "<p>Name:".$row['name']."</br> Time posted:".$row['timepost']."</br><a href='preview.php?from=admin.&pageid=".$row['id']."' style='color:red'>Preview</a></p>";
					echo "</div></td>";
					echo"<td valign='top' width='120px'><div width='120'>Brand:";
						
						if($row['categories']== "Auto"){
							echo"Price: ".$row['price']."</br>";
							echo"Brand: ".$row['brand']."</br>";
							echo"Model: ".$row['model']."</br>";
							echo"Condition: ".$row['conditions']."</br>";
							echo"Categories: ".$row['categories']."</br>";
							echo"Type: ".$row['types']."</br>";
							echo"Trans: ".$row['transmission']."</br>";
							echo"Fuel: ".$row['fuel']."</br>";
							
						}
						else{
							echo"Price: ".$row['price']."</br>";
							echo"Brand: ".$row['brand']."</br>";
							echo"Model: ".$row['model']."</br>";
							echo"Condition: ".$row['conditions']."</br>";
							echo"Categories: ".$row['categories']."</br>";
							echo"Parts: ".$row['cparts']."</br>";
							
						}
						
							
					echo "</div></td>";
					
					echo"<td valign='top'><p align='justify'>" .$row['description']."</p></td>";
				echo"</tr>";
		
			}
			
			echo "</table>";
		}
		else{
			echo '<div style="padding:10px;"><h3 style="color:white;" >No Item Found</h3></div>';
		}
	
	?>
		
		
        <div class="cleaner"></div>
    </div> <!-- END of templatemo_main -->
    
    <!--footer-->
	<?php include("include/footer.php");?>
    
</div> <!-- END of templatemo_wrapper -->

</body>
</html>